<table class="table">
	<tr>
		<th style="width:200px;">ID:#<%= @ticket.id %></th><th><%= @ticket.name.humanize%></th>
	</tr>
	<tr>
		<td valign="top">
			Status: <i><%= Ticket.states.invert[@ticket.status].titleize %></i><br />
			Priority: <i><%= Ticket.priorities.invert[@ticket.priority].titleize %></i><br />
			Type: <i><%= Category.find(@ticket.ticket_type).name.titleize %></i><br />
			Owner: <i><%= @ticket.owner.login if !@ticket.owner.nil? %><%= '---' if @ticket.owner.nil? %></i><br />
			End Date: <i><%= @ticket.end_date if !@ticket.end_date.nil? %><%= '---' if @ticket.end_date.nil? %></i><br />
			<% used_hours = 0 
			for ticket_reply in @ticket.ticket_replies
				if not ticket_reply.hours.nil?
					used_hours += ticket_reply.hours
				end
			end
				%>
			Hours: <i><%= (@ticket.hours.to_s + '/' + used_hours.to_s) if !@ticket.hours.nil? %><%= '---' if @ticket.hours.nil? %></i><br />
			
			<br />
			<% if @ticket.updated_at != @ticket.created_at -%>
			updated by<br />
			<i><%= @ticket.updated_by.login %></i><br />
			updated @<br />
			<i><%= @ticket.updated_at.strftime("%d-%m-%Y %H:%M") %></i><br />
			<br />
			<% end -%>
			<% if  @ticket.tags.count > 0 -%>
			Tags's:<br />
			<ul>
			<%= @ticket.tags.collect{|t| "<li><i>" + link_to(t.name.downcase, :controller => 'project', :project => @ticket.project, :action => 'tag',  :tag => t.name.downcase) + "</i></li>"}.join("\n") %>
			</ul>
			<% end -%>
			<br />
			<br />
			<%= ( ' - [' + link_to('Edit Ticket', :controller => 'ticket', :action => 'edit_ticket', :id => @ticket) +']') if @current_user.has_role?(@ticket.project.name+'_admin') %>
		</td>
		<td valign="top" style="padding-right:10px;">
			<% for ticket_reply in @ticket.ticket_replies -%>
				<table id="t<%= ticket_reply.id %>" class="ticket_reply">
					<tr>
						<td class="ticket_reply_header">
							<b><%= ticket_reply.user.login %>:</b> <i><%= ticket_reply.created_at.strftime("%d-%m-%Y %H:%M") %></i>
						</td>
					</tr>
					<% if ticket_reply.body.size > 0 -%>
					<tr>
						<td class="ticket_reply_body">
							<%= ae_some_html(ticket_reply.body) %>
						</td>
					</tr>
					<% end -%>
					<tr>
						<td class="ticket_reply_info">
							<b>Status:</b> <i><%= Ticket.states.invert[ticket_reply.status].titleize %></i> |
							<b>Priority:</b> <i><%= Ticket.priorities.invert[ticket_reply.priority].titleize %></i> |
							<b>Type:</b> <i><%= Category.find(ticket_reply.ticket_type).name.titleize %></i> |
							<b>Owner:</b> <i><%= ticket_reply.owner.login if !ticket_reply.owner.nil? %><%= '---' if ticket_reply.owner.nil? %></i> |
							<% if !ticket_reply.hours.nil? && ticket_reply.hours > 0 -%><b>Time:</b> <i><%= ticket_reply.hours %></i> |<% end -%>
							<%= link_to('Edit', :controller => 'ticket', :action => 'edit_ticket_reply', :id => ticket_reply) if @current_user.has_role?(@ticket.project.name + '_admin') %>
						</td>
					</tr>
				</table>
			<% end -%>
			
			<hr><hr>
			<% form_tag :action => 'update' do -%>
				<%= render :partial => 'form_edit' %>
				<br />
				<br />
				<br />
				<%= submit_tag "update" %>

			<% end -%>
		</td>
	</tr>
<table>